package org.ooda.distributedsys.loginmodule.config;

import org.ooda.distributedsys.loginmodule.interceptors.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @program: distributedSys
 * @description: register login interceptor
 * @author: Aprilies
 * @create: 2023-03-18 09:31
 **/
@Component
public class LoginServiceInterceptorAppConfig implements WebMvcConfigurer {

    @Autowired
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor).excludePathPatterns("/user/login", "/user/register");
        WebMvcConfigurer.super.addInterceptors(registry);
    }
}
